/**
\file IO.h
*/
#pragma once
#include <lostlbase.h>
#include "System.h"
#include "LoSetupapi.h"
#include "LoPrinterDriver.h"
#include "LoSetup.h"

namespace lo {

	/**
	Printer setup class for installing printer components
	*/
	class PrinterSetup
	{
	public:
		PrinterSetup();
		string	get_FriendlyName() const		{ return m_friendlyName; }
		bool	DoesPortExists(const char *portName, const char *portMonitor = nullptr);
		vector<string>	GetPrintersForDriver(const char *modelName);
		void	InstallDriver(const char *commandLine, const char *infFileName);
		void	InstallDriverAndPrinter(const char *commandLine, const char *infFileName);
		void	InstallPort(const char *name, const char *portMonitor = nullptr);
		void	InstallPrinter(const char *commandLine, const char *infFileName);
		bool	IsDriverInstalled(const char *name);
		bool	IsPrinterInstalled(const char *name);
		void	ParseCommandLine(const char *commandline);
		void	RemoveDriver(const char *modelName);
		void	RemovePrinter(const char *printerName);
		void	set_FriendlyName(const char *name)	{m_friendlyName = name; }
		/** This constant defines an optional string id to store the silent install commandline. */
		static const unsigned IDS_SILENTINSTALL = 10000;
		/** Performs a silent install of either files in the registry or through commandline parameters */
		int		SilentInstall(const char *commandline);
	protected:
		void	ParseInfFile(const Setup::InfFile &inFile);
	private:
		string	m_infFileName;
		string	m_friendlyName;
		string	m_manufacturer;
		string	m_modelName;
		string	m_port;
		string	m_driverPath;
		string	m_dataFile;
		string	m_configFile;
		string	m_helpFile;
		string	m_dependentFiles;
		string	m_monitorName;
		string	m_defaultDataType;
		bool	m_doTestPrint;
		bool	m_isDefault;
		bool	m_isShared;
		bool	m_rawOnly;
		bool	m_queued;
		bool	m_keepPrintedJobs;
		bool	m_enableDevQ;
		bool	m_doCompleteFirst;
		bool	m_directPrinting;
		bool	m_enableBiDi;
		string	m_comment;
		string	m_location;
		string	m_printProcessor;
		string	m_directory;
	};
}